package ScreensManager.ProjectScreen 
{
	import flash.text.TextField;
	import Levels.Level;
	import ScreensManager.Screen;
	import flash.text.TextFormat
	import flash.events.MouseEvent
	import ScreensManager.ScreenManager;
	
	/**
	 * ...
	 * @author ...
	 */
	public class ScoreScreen extends Screen
	{
		private var score:TextField;
		private var point:int;
		private var scoreSound:Score_Sound;
		
		
		
		public function ScoreScreen() 
		{
			this.score = new TextField();
			this.point = 120;
			this.score.defaultTextFormat = makeTextFormat (50, 0xFFFF00, "Brush Script MT")
			this.score.x = Main.getInstance().stage.stageWidth / 2 - this.score.width / 2.8;
			this.score.y = Main.getInstance().stage.stageHeight / 2;
			this.score.text = "" + Level.getPoint() * 10;
			this.addChild(score)
			
			scoreSound = new Score_Sound();
			
			nextLevelButton.buttonMode = true;
			//nextLevelButton.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
			exitButton.buttonMode = true;
			exitButton.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownExit, false, 0, true);
		}
		
		
		
		
		private function makeTextFormat(size:int, color:uint, font:String):TextFormat
		{
			var format:TextFormat = new TextFormat();
			format.color = color;
			format.size = size;
			if(font != "")
				format.font = font;
				
			return format;
		}
		
		private function onMouseDownExit(e:MouseEvent):void
		{
			trace("teste");
			ScreenManager.setCurrentScreen(Screens.INTRODUCTION_SCREEN);
			GameScreen.level1.finishMe();	
		}
		
		
		override public function drawScreen():void 
		{
			super.drawScreen();
			scoreSound.play();
			
			//Main.getInstance().addChild(this);
		}
		
	}

}